UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pjTbybbseYUODjaX15un0+13M5XGUsrnOXYUzfvIXfE='
WHERE
key_id = 'aaa3d9deb97e1b605ea7497b2fb33c6dffca1b0ec592568228b8480bbf62f36f'
AND (
token = 'pjTbybbseYUODjaX15un0+13M5XGUsrnOXYUzfvIXfE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)