UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R5yyGQ75HF44a1xHD1GWdHCZ7E7Bzh7Oz4qgs8ZHBDs=' 
WHERE 
  key_id = '8c5cf8fb4e327e87eb310626aafff8a2f74515bd13fef5f0186c4198b73bf9de' 
  AND (
    token = 'R5yyGQ75HF44a1xHD1GWdHCZ7E7Bzh7Oz4qgs8ZHBDs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040