UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wwWzK/FvqTht7llxD/KCRD1/VZGrRfgwF8ZjrIOJd3w='
WHERE
key_id = '8b7fb265262d9bc3819c79f341baed29654b5a1e2e9cd5fce84d3645fe3d8df5'
AND (
token = 'wwWzK/FvqTht7llxD/KCRD1/VZGrRfgwF8ZjrIOJd3w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)