UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wl6fKKvKbcdclsNph9JBRV2NsSiB99DS52lxSZ+e2bI=' 
WHERE 
  key_id = '47e573937ce7382fe26f68c76a42db71f1e0d1da18f3589467e9815316b8d819' 
  AND (
    token = 'Wl6fKKvKbcdclsNph9JBRV2NsSiB99DS52lxSZ+e2bI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037