UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KR6ilQPl3mn2RPkQenVcsL8uwWoElcRBX++SCG9cw/M=' 
WHERE 
  key_id = 'f257553a44e50a15357e9fee1e2f76f0cbb3846dcb0ae39da04863336fbaa6ab' 
  AND (
    token = 'KR6ilQPl3mn2RPkQenVcsL8uwWoElcRBX++SCG9cw/M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029