UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v6wXBqdsLvr7CS8FXqbsWM9HWiCjTu27sNLmIslE8qA=' 
WHERE 
  key_id = '7e8870d0ff673f2451fb077fd83f728f9d202b0124ac844f1897aecccb3f303f' 
  AND (
    token = 'v6wXBqdsLvr7CS8FXqbsWM9HWiCjTu27sNLmIslE8qA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022