UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NCO8A9OaSvLxeY5uMGgiwbMjzRUrYqbldzLCIl4Dv7c=' 
WHERE 
  key_id = '551d97ca5b49ff691d45f177b3854e2bc97456b93b3c215b8bfb0331f64589d8' 
  AND (
    token = 'NCO8A9OaSvLxeY5uMGgiwbMjzRUrYqbldzLCIl4Dv7c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034