UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UCYEMDA544cJPYcQC/7PvWzoMmmXcdHH1Amy8rzVcVk='
WHERE
key_id = 'ee9052ba4b47564b6f7948361873ce1606cde0f3a055936be8838e5d59cac52c'
AND (
token = 'UCYEMDA544cJPYcQC/7PvWzoMmmXcdHH1Amy8rzVcVk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)