UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hpr9A00UqZk0+JVov8iNkNHotCQfUAsGTX8ZmlHZqDM='
WHERE
key_id = 'ce256661390722b1f1412225285ea22a2b923afd5ea1d1b7efe1764f8a8ebc12'
AND (
token = 'hpr9A00UqZk0+JVov8iNkNHotCQfUAsGTX8ZmlHZqDM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)