UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YPZlQrEuC8+vGUv5Hivm4m5oKKHkPZYfFILmOFsdeQE='
WHERE
key_id = '3a808036523487f0f0f794686b49b4f5bcc48db887c63676602df9307f873d93'
AND (
token = 'YPZlQrEuC8+vGUv5Hivm4m5oKKHkPZYfFILmOFsdeQE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)