UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vTv4+hWLsvJ4m9q6CSFOXJJaakNS2FtM8xQEoSMouR0=' 
WHERE 
  key_id = 'cba678b81474c2b9efab47e2eb994c639f99b7ecba4b5f504afe9a3cd34003ea' 
  AND (
    token = 'vTv4+hWLsvJ4m9q6CSFOXJJaakNS2FtM8xQEoSMouR0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046