UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z3IhQD+rYxASFeea67s40+ibSMf9JkG035+2SLaVVf8=' 
WHERE 
  key_id = 'a4f185733d4dd3694aa8bde48d44dcd5e78e256743906641c5089212d104213a' 
  AND (
    token = 'Z3IhQD+rYxASFeea67s40+ibSMf9JkG035+2SLaVVf8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050