UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '66BAUYeg9x9Dn7NclI9W9vI5ahdbyRoSkonwmTpEWdA='
WHERE
key_id = '3d43314fa0a74804b9d1dfd27e991512e7e865a82e58767b215922a5c4e1ca9b'
AND (
token = '66BAUYeg9x9Dn7NclI9W9vI5ahdbyRoSkonwmTpEWdA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)