UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BdVlbcghTcUwAJnob3CvmO3F3LWv6ugfqvYtUkuoJYo=' 
WHERE 
  key_id = '5218e1c98e4170a4c7c1f60d75141ad0046824756342acc2beef08ff367aa9c7' 
  AND (
    token = 'BdVlbcghTcUwAJnob3CvmO3F3LWv6ugfqvYtUkuoJYo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040