UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tnmlL4o+2fhWdGJK3KMRHlDC0AcPt+WCooYV2CzKuaI=' 
WHERE 
  key_id = '471bb7a0e79f9a931ff53b28b73d60d9f0748d0b5c4287e7565eb7766a71c30e' 
  AND (
    token = 'tnmlL4o+2fhWdGJK3KMRHlDC0AcPt+WCooYV2CzKuaI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038