UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O26tw5qlmknSyL9sFdyZ7s+CppwHcmLGFVeq+NvRlC0=' 
WHERE 
  key_id = '6dfa7623c4301023597721f7f57039b6998f84ec145e7733ccb9dac56526d428' 
  AND (
    token = 'O26tw5qlmknSyL9sFdyZ7s+CppwHcmLGFVeq+NvRlC0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019