UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oR+XuFXto6Nh8PVqZ451uDIEWHByQxeUJevjkPEWpwY=' 
WHERE 
  key_id = '0e0648fa833bdee8aa9367282d5c18a2acf939201a263345788ef3d6252278d7' 
  AND (
    token = 'oR+XuFXto6Nh8PVqZ451uDIEWHByQxeUJevjkPEWpwY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038