UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '36Ek2ua1g/Lv22sadYW6Yw7oe0XknPlGXy1+RlFXlmc='
WHERE
key_id = '6ca27e0ede464225d8f188e97d4695584c727525db1f39a84ab7774073a00326'
AND (
token = '36Ek2ua1g/Lv22sadYW6Yw7oe0XknPlGXy1+RlFXlmc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)