UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wTdyVds27V3SQ6FiK4fgfbjlxs0QuUQ2F3H2qpiQ4Sk=' 
WHERE 
  key_id = 'd90c51e7748466965da6675af1944d28fb0720da46a026bc0c45ff8d9b8506de' 
  AND (
    token = 'wTdyVds27V3SQ6FiK4fgfbjlxs0QuUQ2F3H2qpiQ4Sk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048