UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DMLAry+814FG+HaPgKqmU3Du6HN4wV86pTP57FlKTGM=' 
WHERE 
  key_id = '00e6723195de39ff96563b654b72bdfa47a2991a771e7db962836285e535ea47' 
  AND (
    token = 'DMLAry+814FG+HaPgKqmU3Du6HN4wV86pTP57FlKTGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022