UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hwvwli8EWXJ3PI6M831vKQAbTtLUiS+vUVZi+Yiqg/k=' 
WHERE 
  key_id = '742de4f88f8d260383e495ea3e54e1cf7692ef86475755e7d451ed464d848114' 
  AND (
    token = 'Hwvwli8EWXJ3PI6M831vKQAbTtLUiS+vUVZi+Yiqg/k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038