UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZMfWU3+KtVJUhUQKUCtW+WCg80mU6/vYhHlqSZQMB/k=' 
WHERE 
  key_id = 'fded2f352ebc62635afc04ed34ca8ee69d0ad51f28487c5fc7fdabf0b3ef9fc6' 
  AND (
    token = 'ZMfWU3+KtVJUhUQKUCtW+WCg80mU6/vYhHlqSZQMB/k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038