UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jyIuO3T8QsaP4yUdcixZ87zDaTL3lNi+eFWQIEHAtBI=' 
WHERE 
  key_id = '2f6f4c152451bf12d4496f3722885df4f7b2d64dab6f35a8c9a8b9c6c51a72b4' 
  AND (
    token = 'jyIuO3T8QsaP4yUdcixZ87zDaTL3lNi+eFWQIEHAtBI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054