UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UpJFxg8zIhwHTCECBimQxsMdlJEYrJ2GfxKGh+hWQOo='
WHERE
key_id = '8c763c639c1e58f801b828946186c93dd81475ac6745e253b2cbacb6ba5933c2'
AND (
token = 'UpJFxg8zIhwHTCECBimQxsMdlJEYrJ2GfxKGh+hWQOo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)