UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wT6iqoWm7QYnrHqP95VqAm57EA6wPxpVoDi+7RTZbQ0='
WHERE
key_id = 'ef0eeb788bcf5f3afef1369cba13b54a88133f925c54429249320d947eb39a33'
AND (
token = 'wT6iqoWm7QYnrHqP95VqAm57EA6wPxpVoDi+7RTZbQ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)