UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CwxawgjtJbVix4K8pyt6rsa5kGBoEFtC12CU0XDvhn4='
WHERE
key_id = '0b852472f3f53c8e4bd253e0ba569d42b9165e20161fef54369cfd4043297e0a'
AND (
token = 'CwxawgjtJbVix4K8pyt6rsa5kGBoEFtC12CU0XDvhn4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)