UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BZw8VwSm6nLPIMHqMtsONe2jeunKBX5g+5GxsQM3yfU=' 
WHERE 
  key_id = '8067eea657ed60e71366a40e216d0019ca6406babb8f18d9f7aac58c656a6c0b' 
  AND (
    token = 'BZw8VwSm6nLPIMHqMtsONe2jeunKBX5g+5GxsQM3yfU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047