UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u0wMbBEbMvxLEWqK2MAZNgzROoJ3xZfMVoSeezUD4eY=' 
WHERE 
  key_id = '64bc7824b0a8c90d5d7d73b8e4239d8cf476b9720671920684862cee0a206007' 
  AND (
    token = 'u0wMbBEbMvxLEWqK2MAZNgzROoJ3xZfMVoSeezUD4eY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032