UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '387U56hRLoYsZvV7/wTuSxFJjRcn3OWW+jfHDJbsmi4=' 
WHERE 
  key_id = 'ac998b4773f6212afab285dc14b17a2e09e4bfa0ede5ec69a86d7522a21e221e' 
  AND (
    token = '387U56hRLoYsZvV7/wTuSxFJjRcn3OWW+jfHDJbsmi4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024