UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n1pim71VOc5rZqJt42UDGE6uoXuX3ZGIduwYOA+HUHY='
WHERE
key_id = '1631fe83af7bbdebc4f6cf5d7eb68ba3bfd4df5319b4b2ed48d12767da8240c0'
AND (
token = 'n1pim71VOc5rZqJt42UDGE6uoXuX3ZGIduwYOA+HUHY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)