UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HmTHUM9XUXta+5bAHPFj2+SFnIYvy2xoF3EGKgjGp04=' 
WHERE 
  key_id = '60edea895b6dd3117648044cb1848721ed9b9008fce1d78747bff56b62ff51a4' 
  AND (
    token = 'HmTHUM9XUXta+5bAHPFj2+SFnIYvy2xoF3EGKgjGp04=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064