UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dBlczDbM8wvViV31ycDgVzg44txxDQjjeJYEsIN3/jA=' 
WHERE 
  key_id = '89f0926c2e6e6eb8e57600a40fced940e3bdc6b4892485117eed409c19c1beae' 
  AND (
    token = 'dBlczDbM8wvViV31ycDgVzg44txxDQjjeJYEsIN3/jA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035