UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T0KhDbj2+q+Wpmp8e/kJBGk5eEN9JptRhCjSXsM1QO8='
WHERE
key_id = 'ee90a5a75e7cfcdc124fb8b8d80ec5370375e356ea5c702ad8901b42ceb72cfc'
AND (
token = 'T0KhDbj2+q+Wpmp8e/kJBGk5eEN9JptRhCjSXsM1QO8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)