UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5z5PnCobHX3BFZV7oD1qODPojd9QH3idO/493P0C+K8='
WHERE
key_id = 'b9328b40a821b91c8f9f36e5fae4c8c244f801ae3c6eddad8eb6a68ba287c5c0'
AND (
token = '5z5PnCobHX3BFZV7oD1qODPojd9QH3idO/493P0C+K8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)