UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8WyWA1Gc1Z0+EYbZGdrf+byAAN6QtsVde9hkR7uOyQ0=' 
WHERE 
  key_id = 'ccba29a92f447978bc93c96d7efb86cf24b92b2824bfb66796d1d7862a454af2' 
  AND (
    token = '8WyWA1Gc1Z0+EYbZGdrf+byAAN6QtsVde9hkR7uOyQ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024