UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'l1A2oXFdnrGQHpoZT26Vi8EwGQDguq8NlwxZJD+l8l8='
WHERE
key_id = 'd5c733ebed9191456e3c77dd03ff45469ea3c86ad3b4b7667d9c1a3072ec127f'
AND (
token = 'l1A2oXFdnrGQHpoZT26Vi8EwGQDguq8NlwxZJD+l8l8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)