UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TjM7MVI5vJksZklcl8RzxQhT0FayOmk5hbZ1ljkm6+g='
WHERE
key_id = 'a4e6f1ac794f6e248eb401c62d8d15ac24b4be25d8d50c324adb1d31afd5a5f6'
AND (
token = 'TjM7MVI5vJksZklcl8RzxQhT0FayOmk5hbZ1ljkm6+g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)