UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jncJsuTnweS3KRoIFSSlL3muZKBxRDUAsO8MXLOUXOg='
WHERE
key_id = 'a1ac5f439bffaeb5e9deb73994eaf48348d3cdeeb2815b9218de9dd319a4cea0'
AND (
token = 'jncJsuTnweS3KRoIFSSlL3muZKBxRDUAsO8MXLOUXOg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)