UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PqFMUwRTHKoNaKtGElfhjIsSP/whwSuOyUDnARowR50=' 
WHERE 
  key_id = '1667a196fcc72c554ecac1787a200d7b94e6021df683c93bdd340a9e04dc3d8e' 
  AND (
    token = 'PqFMUwRTHKoNaKtGElfhjIsSP/whwSuOyUDnARowR50=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032