UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GKdKVVmu1ntUdvmv3mJEs+gxKSjFqG4EUt5w47ypsM8=' 
WHERE 
  key_id = '8cee212659b0ecaf1967442c379a867eb7b5d307389d6249c6fb27d40f6f7005' 
  AND (
    token = 'GKdKVVmu1ntUdvmv3mJEs+gxKSjFqG4EUt5w47ypsM8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032