UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FS/ue19dVcdzvfH9hdD7uJi/Aelw8TSQA9fVN29pdCI=' 
WHERE 
  key_id = '51ad7d6de4a0b0fd83900e3b825778932729df4b8ec83f60cc4d50d32f52f816' 
  AND (
    token = 'FS/ue19dVcdzvfH9hdD7uJi/Aelw8TSQA9fVN29pdCI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034