UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ygqGwSWeCyDBpWXwotn0XYAIyWV6YZIwXvp6vr4yXlg='
WHERE
key_id = '1ba3f8c67103578fa1266bc67a878b18f3f926f1ce3bcb795535bbd54d485f3e'
AND (
token = 'ygqGwSWeCyDBpWXwotn0XYAIyWV6YZIwXvp6vr4yXlg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)