UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VYp0+r9DEdz+SeaaocWDsq22lbw1yu1Gh0+5G0iWFgk=' 
WHERE 
  key_id = '6f452f47fa6859877668437f834c384a504c4c152906141890fab96597de6171' 
  AND (
    token = 'VYp0+r9DEdz+SeaaocWDsq22lbw1yu1Gh0+5G0iWFgk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040