UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RW7+Yf9B2ejyxhMcaCJeFKGE/HX5UrR3eFbL2ltTI3M=' 
WHERE 
  key_id = '3352982ab8934c15017caeb8a4b30fc9bcefbb613a8bc004e09d05a45d3c4e02' 
  AND (
    token = 'RW7+Yf9B2ejyxhMcaCJeFKGE/HX5UrR3eFbL2ltTI3M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029