UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '05HV0uz1xaUlJrxSdBfQRAJ+lau+PC2/f8eGbmma2Lg=' 
WHERE 
  key_id = 'fe654bd57e04c0f79d4a0298cb8a621019ca7ce0366bffd7db35bc5f32f027a1' 
  AND (
    token = '05HV0uz1xaUlJrxSdBfQRAJ+lau+PC2/f8eGbmma2Lg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038