UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SEmldBlPW6TDCnKPS/iUDg5MxzNnJip3THaqGhkDsN8='
WHERE
key_id = 'ec25769ad4135fd94ada588c58c617054991613b6b94f3194ca51569973ee4f7'
AND (
token = 'SEmldBlPW6TDCnKPS/iUDg5MxzNnJip3THaqGhkDsN8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)