UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oVdHU7kLWzUeun+/eCfQyBvcTvLcIwndd1Nrgv+u4ac=' 
WHERE 
  key_id = '54c9260b5b67788092e718bab659953c415f631bd9eaa242ae05ed8ba9f0a474' 
  AND (
    token = 'oVdHU7kLWzUeun+/eCfQyBvcTvLcIwndd1Nrgv+u4ac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033