UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iDFcg0amNr2Klqq6D+XnxUjPV8O57s6X0HCVSWNk/Qw=' 
WHERE 
  key_id = 'c2d0e4cf094fb958a5ce0f56e6fc07e2d291ddb6a05486490f2791013763785b' 
  AND (
    token = 'iDFcg0amNr2Klqq6D+XnxUjPV8O57s6X0HCVSWNk/Qw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036