UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XBUZjc7feFJrvilCul+2S2SK4VE8z5zp4Ql1v/ilpgY='
WHERE
key_id = 'ca4ad8b6e1fe82791b8fcafe2508bd3ad59bdeaf182b227e7a0a7674c99a9ba4'
AND (
token = 'XBUZjc7feFJrvilCul+2S2SK4VE8z5zp4Ql1v/ilpgY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)