UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a7lXdt+Fh0Rkm0W9DqHBjKF5fK4FOv6ra105nAauef4=' 
WHERE 
  key_id = '1a4e00b991b40088fa584357baddd425fe9d640486bcc32841bceec463a08036' 
  AND (
    token = 'a7lXdt+Fh0Rkm0W9DqHBjKF5fK4FOv6ra105nAauef4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020