UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6NTJ5B29K3QsbQmvflYNUWKVppT4DyVOeiEjPLq+Yfw='
WHERE
key_id = 'c2c54cb1858b41a9cd4df1f7c78eeb636ab2c0a55fca30da1711403ac8e80c8e'
AND (
token = '6NTJ5B29K3QsbQmvflYNUWKVppT4DyVOeiEjPLq+Yfw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)