UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mOGvz8X1nSZSudDINti5aV/r6vTu5+OVITIsj2Fs8/I='
WHERE
key_id = 'f4b12016f299e832836e394cb115c738531cb08cafdae6a40d3d83037d152778'
AND (
token = 'mOGvz8X1nSZSudDINti5aV/r6vTu5+OVITIsj2Fs8/I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)