UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v22FADFiRLVXUV9NW2WbSppkdTEnv+GcKjZfulz94zk=' 
WHERE 
  key_id = 'deea37e3e53d779dd44620d935bae6150188eb5e221fe651e09748cf8b35d268' 
  AND (
    token = 'v22FADFiRLVXUV9NW2WbSppkdTEnv+GcKjZfulz94zk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059