UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'puaNCXLU7TL2iEjCznKzomzNqtnlGu2SP7/4PyVgpug=' 
WHERE 
  key_id = '58908bf5b75723bed39933e7abfb7ae71010d3797402c14fcc84b6d18f097db0' 
  AND (
    token = 'puaNCXLU7TL2iEjCznKzomzNqtnlGu2SP7/4PyVgpug=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048