UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qqllw9tpB7WAx7qwkHa9leIEuXhKT1N+RuWwz+Hnawg=' 
WHERE 
  key_id = '31d288179092342f2cf7efe90f95ce29231cc96c18dcba241996174b816d0fb6' 
  AND (
    token = 'qqllw9tpB7WAx7qwkHa9leIEuXhKT1N+RuWwz+Hnawg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035